#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int mod = 1000000007;

ll a[1010];
int n;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n;

    for(int i = 1; i <= n; i++) cin >> a[i];

    ll sum1 = a[1];

    for(int i = 2; i <= n; i++)
    {
        sum1 = (sum1 | a[i]);
    }

    ll sum2 = 1;
    for(int i = 1; i <= n; i++)
    {
        sum2 = ((sum1 % mod) * (sum2 % mod)) % mod;
    }

    cout << sum2 << '\n';

    return 0;
}